<?php

namespace PointPresse\BlogBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Journalist
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="PointPresse\BlogBundle\Entity\JournalistRepository")
 * @ORM\Table(name="journalist")
 */
class Journalist implements \Symfony\Component\Security\Core\User\UserInterface
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="lastname", type="string", length=255, nullable=false)
     */
    private $lastname;

    /**
     * @var string
     *
     * @ORM\Column(name="firstname", type="string", length=255, nullable=false)
     */
    private $firstname;

    /**
     * @var string
     *
     * @ORM\Column(name="login", type="string", length=255, nullable=false, unique=true)
     */
    private $login;

    /**
     * @var string
     *
     * @ORM\Column(name="password", type="string", length=255, nullable=false)
     */
    private $password;
    

    /**
     * @ORM\OneToMany(targetEntity="PointPresse\BlogBundle\Entity\Post",mappedBy="journalist", cascade={"persist"})
     */
    private $posts;

	
    public function __construct($l=null,$f=null,$log=null,$pass=null)
    {
	$this->firstname=$f;
        $this->lastname=$l;
        $this->login=$log;
        $this->password=$pass;
        $this->posts= new \Doctrine\Common\Collections\ArrayCollection();
		
    }
    
    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set lastname
     *
     * @param string $lastname
     * @return Journalist
     */
    public function setLastname($lastname)
    {
        $this->lastname = $lastname;
    
        return $this;
    }

    /**
     * Get lastname
     *
     * @return string 
     */
    public function getLastname()
    {
        return $this->lastname;
    }

    /**
     * Set firstname
     *
     * @param string $firstname
     * @return Journalist
     */
    public function setFirstname($firstname)
    {
        $this->firstname = $firstname;
    
        return $this;
    }

    /**
     * Get firstname
     *
     * @return string 
     */
    public function getFirstname()
    {
        return $this->firstname;
    }

    /**
     * Set login
     *
     * @param string $login
     * @return Journalist
     */
    public function setLogin($login)
    {
        $this->login = $login;
    
        return $this;
    }

    /**
     * Get login
     *
     * @return string 
     */
    public function getLogin()
    {
        return $this->login;
    }

    /**
     * Set password
     *
     * @param string $password
     * @return Journalist
     */
    public function setPassword($password)
    {
        $this->password = $password;
    
        return $this;
    }

    /**
     * Get password
     *
     * @return string 
     */
    public function getPassword()
    {
        return $this->password;
    }
  
    
    

    /**
     * Add posts
     *
     * @param \PointPresse\BlogBundle\Entity\Post $posts
     * @return Journalist
     */
    public function addPost(\PointPresse\BlogBundle\Entity\Post $post)
    {
        $this->posts[] = $post;      
        return $this;
    }

    /**
     * Remove posts
     *
     * @param \PointPresse\BlogBundle\Entity\Post $posts
     */
    public function removePost(\PointPresse\BlogBundle\Entity\Post $post)
    {
        $this->posts->removeElement($post);
    }

    /**
     * Get posts
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getPosts()
    {
        return $this->posts;
    }
    
    public function eraseCredentials()
    {
    }
    
    public function getRoles() {
        return array('ROLE_USER');       
    }

    public function getSalt() {
        
    }

    public function getUsername() {
        $this->getLogin();
    }

}